django admin prefetch_related

149

django admin prefetch_related -

from django.contrib import admin

class MyModelAdmin(admin.ModelAdmin):
    def get_queryset(self, request):
        queryset = super(MyModelAdmin, self).get_queryset(request)
        queryset = queryset.prefetch_related('user')
        return queryset

Comments

Submit
0 Comments